from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService

# 设置正确的驱动路径
service = ChromeService(executable_path="D:\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe")
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
# 启动浏览器
driver = webdriver.Chrome()

# 打开网页
driver.get("https://example.com")

# 定位输入框元素
input_element = driver.find_element_by_name("username")

# 输入文本
input_element.send_keys("your_username")

# 关闭浏览器
driver.quit()